package com.zhentao.controller;

import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.pojo.car.dto.ChargeCarInfoDto;
import com.zhentao.model.pojo.car.dto.ProvinceCarsDto;
import com.zhentao.model.pojo.par.dto.ChargeParOrdersDto;
import com.zhentao.service.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("/auth/cars")
public class ChargeCarsController {
    @Resource
    ChargeCarInfoService chargeCarInfoService;
    @Resource
    LicensePlateInfoService licensePlateInfoService;
    @Resource
    ProvinceCarsService provinceCarsService;
    @Resource
    ChargeCarBrandService chargeCarBrandService;
    @Resource
    private ChargeParOrdersService chargeParOrdersService;

    /**
     * @return 查询所有车辆信息
     * WXQ
     */
    @GetMapping("/CarList")
    public ResponseResult getCarList() {
        return chargeCarInfoService.CarList();
    }

    /**
     * @return 查询所有省信息
     * WXQ
     */
    @GetMapping("/LicenseList")
    public ResponseResult getLicenseList() {
        return provinceCarsService.licensePlateInfoService();
    }

    /**
     * @return 查询车辆品牌列表
     * WXQ
     */
    @GetMapping("/BrandList")
    public ResponseResult getBrandList() {
        return chargeCarBrandService.getBrandList();
    }

    /**
     * @param multipartFile
     * @return 汽车图片上传
     * WXQ
     */
    @PostMapping("/CarsSaveMinio")
    public ResponseResult getCarsSaveMinio(@RequestParam("file") MultipartFile multipartFile) {
        return chargeCarInfoService.getCarsSaveMinio(multipartFile);
    }

    /**
     * @param chargeCarInfoDto
     * @return 汽车信息添加
     * WXQ
     */
    @PostMapping("/CarsAdd")
    public ResponseResult getCarsAdd(@RequestBody ChargeCarInfoDto chargeCarInfoDto) {
        return chargeCarInfoService.getCarsSave(chargeCarInfoDto);
    }

    /**
     * @param
     * @return 获取车牌号的省
     * WXQ
     */
    @PostMapping("/CarsProvince")
    public ResponseResult getCarsProvince(@RequestBody ProvinceCarsDto provinceCarsDto) {
        return provinceCarsService.getCarsProvince(provinceCarsDto.getCarNo());
    }
    /**
     * @param
     * @return 修改车辆信息
     * WXQ
     */
    @PostMapping("/CarsUpdate")
    public ResponseResult getCarsUpdate(@RequestBody ChargeCarInfoDto chargeCarInfoDto) {
        return chargeCarInfoService.getCarsUpdate(chargeCarInfoDto);
    }

    @PostMapping("/CarsBatteryCapacity")
    public ResponseResult getCarsBatteryCapacity(@RequestBody ChargeCarInfoDto chargeCarInfoDto) {
        return chargeCarInfoService.getCarsBatteryCapacity(chargeCarInfoDto);
    }

    /**
     * @description  管理端  车辆信息管理列表
     * @author 大毅
     * @param chargeParOrdersDto
     * @return com.zhentao.model.common.dtos.ResponseResult
     */
    @PostMapping("/chargeParOrders/list")
    public ResponseResult chargeParOrdersList(@RequestBody ChargeParOrdersDto chargeParOrdersDto){
        return chargeParOrdersService.chargeParOrdersList(chargeParOrdersDto);
    }

    /**
     * @description  管理端  车辆信息管理---删除
     * @author 大毅
     * @param id
     * @return com.zhentao.model.common.dtos.ResponseResult
     */
    @DeleteMapping("/chargeParOrders/delete")
    public ResponseResult chargeParOrdersDelete(Long id){
        return chargeParOrdersService.chargeParOrdersDelete(id);
    }
}
